<!DOCTYPE html>
<html>

	<head>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>H+ 后台主题UI框架 - 空白页</title>
		<meta name="keywords" content="">
		<meta name="description" content="">

		<link rel="shortcut icon" href="favicon.ico">
		<link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
		<link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
		<!-- jqgrid-->
		<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
		<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
		<link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
		<link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
		<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
		<script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
		<script src="__STATIC__/sc/js/page.js"></script>
		<style>
			.checkbox-inline input[type=checkbox],
			.radio-inline input[type=radio] {
				margin-top: 4px;
			}
		</style>
		<style>
			#pagesize {
				height: 23px;
			}
		</style>
	</head>

	<body style="color:#333;padding:3px;">
		<!-- 标题 -->
		<div class="page-heade">
			<h2 class="title_color text-center">供应商管理</h2>
		</div>
		<!-- 标题 -->
		<div>

			<form action="#" method="post" id="form_check" accept-charset="utf-8" class="form-inline formpage">
				<input type="hidden" value='{$page}' name="page" id="page-go" />
				<input type="hidden" value='{$list}' name="list" id="list-go" />
				<table class="row-margin-top tab-content table-bordered table text-left" border="1">
					<tr>
						<td colspan="6">
							<button class="btn btn-primary btn-sm newgys" type="button">新增供应商</button>
							<button class="btn btn-primary btn-sm" type="button">导入供应商</button>

						</td>
					</tr>
					<tr>
						<td style="min-width: 140px" class="text-right"><label for="" class="form-label">供应商编号：</label></td>
						<td><input type="text" class="form-control" value='{$data.no}' name="no"></td>
						<td style="min-width: 140px" class="text-right"><label for="" class="form-label">供应商简称：</label></td>
						<td><input type="text" class="form-control" name="gys_jian" value='{$data.gys_jian}'></td>
						<td style="min-width: 140px" class="text-right"><label for="" class="form-label">供应商类别：</label></td>
						<td><input type="text" class="form-control" name="type" value="{$data.type}"></td>
					</tr>
					<tr>
						<td colspan="6" class="text-center">
							<input type="button" value="查询" class='btn btn-sm btn-info' id="check" />
							<input type="button" value="清空查询条件" class='btn btn-sm btn-info' id="clear_check" />
							<button class="btn btn-info btn-sm LendExcel" type="button">导出Excel</button>
						</td>
					</tr>
				</table>
			</form>
			<table class="table table-striped row-margin-top table-bordered table-hover text-center bud_hei">
				<tr class="info">
					<th class="text-center">No.</th>
					<th class="text-center">供应商编号</th>
					<th class="text-center">供应商简称</th>
					<th class="text-center">供应商类别</th>
					<th class="text-center">公司注册地址</th>
					<th class="text-center">电话</th>
					<th class="text-center">联系人</th>
					<th class="text-center">添加人</th>
					<th class="text-center">添加时间</th>
					<th class="text-center">修改人</th>
					<th class="text-center">修改时间</th>
					<th class="text-center">操作</th>
				</tr>

				{volist name="apply" id="voa"}
				<tr class="text-center">
					<td>{$i}</td>
					<td>
						<a onclick="details({$voa.id})">{$voa.no}</a>
					</td>
					<td>{$voa.gys_jian}</td>
					<td>{$voa.type}</td>
					<td>{$voa.sign_address}</td>
					<td>{$voa.phone}</td>
					<td>{$voa.contact}</td>
					<td>{$voa.cname}</td>
					<td>{$voa.created_on}</td>
					<td>{$voa.mname}</td>
					<td>{$voa.modifiled_on}</td>
					<td>
						<a onclick="xiugai({$voa.id})">修改</a>
						<a onclick="shanchu({$voa.id})">删除</a>
					</td>
				</tr>

				{/volist}

			</table>
			<h5 class="text-center" id="pagesc" style="font-size: 16px;font-weight: 500">
            			<script>
                            $(function(){
                                pageSC("pagesc",{$sum},{$page},{$maxpage})
                            })
                        </script>每页显示
          <select id="pagesize">
            <option value='10' {if condition="$list eq 10"}selected{/if}>10条</option>
            <option value='15'{if condition="$list eq 15"}selected{/if}>15条</option>
            <option value='20'{if condition="$list eq 20"}selected{/if}>20条</option>

          </select>
        </h5>

		</div>
		<!-- 全局js -->
		<script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
		<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
		<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
		<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
		<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="__STATIC__/layout/js/common.js"></script>
		<script>
			function details(id) {
				var index = layer.open({
					type: 2,
					title: '查看详情',
					area: ['80%', '80%'],
					maxmin: true,
					content: '{:url("details")}?gid=' + id
				})
				layer.full(index)
			}

			function xiugai(id) {
				location.href = "{:url('addgys')}?gid=" + id;
			}

			function shanchu(id) {
				swal({
						title: "提示",
						text: "您真的要删除这个供应商么？",
						type: "warning",
						showCancelButton: true,
						confirmButtonColor: "#FF3333",
						confirmButtonText: "是的我要删除",
						cancelButtonText: "取消",
						closeOnConfirm: true
					},
					function(isConfirm) {
						if(isConfirm) {
							$.post("{:url('drop')}", {
								id: id
							}, function(re) {
								if(re == 1) {
									swal({
										title: "完成",
										text: "供应商已删除",
										type: "success"
									}, function() {
										location.href = '{:url("manage")}';
									});
								} else {
									swal({
										title: "错误",
										text: "系统繁忙请稍后再试",
										type: "warning"
									});
								}
							})
						}
					})
			}
			$(".newgys").click(function() {
				location.href = "{:url('addgys')}";
			})
			$(document).ready(function() {
				var $ObjectNum = $(".ObjectNum");
				toNum($ObjectNum);
				var $gysText = $(".gystext");
				var num = 8;
				$gysText.each(function() {
					wordlimit($(this), num)
				})

			})

			function wordlimit(cname, num) {　
				for(var i = 0; i < cname.length; i++) {　　　　　　
					var nowLength = cname[i].innerHTML.length;
					if(nowLength > num) {
						return cname[i].innerHTML = cname[i].innerHTML.substr(0, num) + '...'
					}
				}
			}　

			//翻页
		
			$("#check").click(function() {
				$("#page-go").val(1);
				$(".formpage").submit();
			})
			$("#clear_check").click(function() {
				$("input[type='text']").val("");
				$("#page-go").val(1);
				$("#start").val("");
				$("#end").val("");
				$("#material_type_id").val(0);
				$(".formpage").submit();
			})
		</script>
	</body>

</html>